﻿$(function() {
    jq_buttons();
    $('.jq_createName').Watermark('Event Name');
    $('.jq_createEvent').click(jq_createEvent_click);
});

function jq_createEvent_click() {
    var eventName = $('.jq_createName').val();
    createEvent(eventName);
}

function createEvent(eventName) {
    $.getJSON("Event/Create/" + eventName, createEvent_callback);
}

function createEvent_callback(response) {
    if (response.Success) {
        var message = $('#createEventResponse');
        message.empty();
        message.text(response.Message + " was succesfully createed");
        message.hide();
        message.fadeIn(1000);
        setTimeout(function() { message.fadeOut(300); }, 3000);
        $('.jq_createName').val('');
    }
}